﻿from django.db import models

# Create your models here.

class Catalog(models.Model):
    parent = models.ForeignKey('self', blank=True, null=True, verbose_name='Принадлежность')
    name = models.CharField(max_length=64, verbose_name='Наименование')
    description = models.TextField(blank=True, verbose_name='Описание')
    date = models.DateTimeField(auto_now_add=True)   
  
    class Meta:
        ordering = ['name']
    
    class Admin:
        pass

    def __unicode__(self):
        return self.name



class Fileprog(models.Model):
	catalog = models.ForeignKey('Catalog', verbose_name='Каталог')
	name = models.CharField(max_length=64, verbose_name='Наименование')
	version = models.CharField(max_length=12, blank=True, verbose_name='Версия')
	description = models.CharField(max_length=128, blank=True, verbose_name='Описание')
	fulldescription = models.TextField(blank=True, verbose_name='Развернутое описание')
	file = models.FileField(upload_to='softupload/', verbose_name='Файл')
	realfilename = models.CharField(max_length=128, blank=True)
	size = models.IntegerField(blank=True)
	type = models.CharField(max_length=128, blank=True)
	date = models.DateTimeField(auto_now_add=True)   

	class Meta:
		ordering = ['name']

	class Admin:
		pass

	def __unicode__(self):
		return self.name